package com.zw.mes.module.system.controller;

import com.zw.mes.base.BaseController;
import com.zw.mes.common.JsonResult;
import com.zw.mes.entity.sys.Log;
import com.zw.mes.module.system.service.LogService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Description: 日志接口
 *
 * 权限：
 * system:log:view 查看
 *
 * @Author: China.sgl
 * @Date: 2019/11/28 13:48*/


@Controller
@RequestMapping("/sys/log")
@SuppressWarnings("all")
public class LogController extends BaseController {

    @Autowired
    private LogService logService;

    @GetMapping
    @RequiresPermissions({"system:log:view"})
    public String logPage() {
        return "system/log/page";
    }

    /**
     * 日志列表
     *
     * @param log 条件
     * @return json
     */
    @PostMapping("/list")
    @ResponseBody
    @RequiresPermissions({"system:log:view"})
    public JsonResult list(Log log) {
        startPage();
        List<Log> list = logService.findByCondition(log);
        return jsonResult(list);
    }

}
